home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 August (Alt) / CHIP 2005-08.1.iso / program / guvenlik / syslinux-3.07.exe / com32 / lib / pci / writex.c < prev   
Encoding:
C/C++ Source or Header  |  2005-01-05  |  786 b   |  46 lines

  1. #include "pci/pci.h"
  2.  
  3. void BWL(pci_write) (TYPE v, pciaddr_t a)
  4. {
  5.   for (;;) {
  6.     switch ( __pci_cfg_type ) {
  7.     case PCI_CFG_AUTO:
  8.       pci_set_config_type(PCI_CFG_AUTO);
  9.       break;            /* Try again */
  10.  
  11.     case PCI_CFG_TYPE1:
  12.       {
  13.     uint32_t oldcf8;
  14.     cli();
  15.     oldcf8 = inl(0xcf8);
  16.     outl(a, 0xcf8);
  17.     BWL(out) (v, 0xcfc + (a & 3));
  18.     outl(oldcf8, 0xcf8);
  19.     sti();
  20.       }
  21.       return;
  22.  
  23.     case PCI_CFG_TYPE2:
  24.       {
  25.     uint8_t oldcf8, oldcfa;
  26.     
  27.     if ( a & (0x10 << 11) )
  28.       return;
  29.     
  30.     cli();
  31.     oldcf8 = inb(0xcf8);
  32.     oldcfa = inb(0xcfa);
  33.     outb(0xf0 + ((a >> (8-1)) & 0x0e), 0xcf8);
  34.     outb(a >> 16, 0xcfa);
  35.     BWL(out) (v, 0xc000 + ((a >> (11-8)) & 0xf00) + (a & 0xff));
  36.     outb(oldcf8, 0xcf8);
  37.     outb(oldcfa, 0xcfa);
  38.     sti();
  39.       }
  40.  
  41.     default:
  42.       return;            /* Do nothing */
  43.     }
  44.   }
  45. }
  46.